<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '任务管理';
$this->params['breadcrumbs'][] = $this->title;
?>

<style type="text/css">
    .task-index {
        width: 800px;
        margin: 0 auto;
    }

    .task-index .grid-view {
        margin: 1em;
    }
</style>

<div class="task-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p style="margin-top: 1em;">
        <?= Html::a('创建 任务', ['create'], ['class' => 'btn btn-success']) ?>
    </p>


    <div id="w0" class="grid-view">
        <table class="table table-striped table-bordered">
            <thead>
                <tr style="text-align: center;">
                    <th>年-月</th>
                    <th>任务数</th>
                    <th class="action-column">&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                <?php if (null != $data && count($data) > 0) {
                    foreach ($data as $d) { ?>
                        <tr>
                            <td><?= date('Y-m', strtotime($d->yearmonth)) ?></td>
                            <td><?= $d->task_num ?></td>
                            <td>
                                <a href="/index.php?r=task%2Fview&amp;month=<?= date('Y-m', strtotime($d->yearmonth)) ?>" title="查看"><span class="glyphicon glyphicon-eye-open"></span></a>
                                <a href="/index.php?r=task%2Fupdate&amp;month=<?= date('Y-m', strtotime($d->yearmonth)) ?>" title="修改"><span class="glyphicon glyphicon-pencil"></span></a>
                            </td>
                        </tr>
                <?php }
                } ?>
            </tbody>
        </table>
    </div>


</div>